import 'package:flutter/material.dart';
import "package:get/get.dart";

class TaskList extends StatefulWidget {
  const TaskList({super.key});
  @override
  State<TaskList> createState() => _HomePageState();
}

class _HomePageState extends State<TaskList>
    with SingleTickerProviderStateMixin {
  late TabController _tabController;
  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 2, vsync: this);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          backgroundColor: Color(0xffffffff),
          centerTitle: true,
          leadingWidth: 40,
          title: Text('发布任务',style: TextStyle(fontSize: 16)),
          leading: IconButton(
            onPressed: () {
              Get.back();
              print('object');
            },
            icon: Image.asset('static/images/back.png'),
          ),
        ),
        body: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Container(
              // width: 150,
              child: TabBar(
                  indicatorWeight: 3.0,
                  labelPadding: EdgeInsets.symmetric(vertical: 5),
                  indicatorSize: TabBarIndicatorSize.tab,
                  indicatorPadding: EdgeInsets.only(right: 30, left: 30),
                  labelColor: Color(0xff333333),
                  unselectedLabelColor: Color(0xff999999),
                  dividerColor: Colors.transparent,
                  controller: _tabController,
                  overlayColor: WidgetStateProperty.all(Colors.transparent),
                  tabs: [
                    Text(
                      '进行中',
                      style: TextStyle(fontSize: 18),
                    ),
                    Text(
                      '已结束',
                      style: TextStyle(fontSize: 18),
                    ),
                  ]),
            ),
            Expanded(
              child: ListView(
                children: [
                  for(var item in [])
                  Container(
                    margin: EdgeInsets.symmetric(horizontal: 15, vertical: 15),
                    padding: EdgeInsets.all(10),
                    decoration: BoxDecoration(
                        border: Border.all(color: Color(0XFFDDDDDD)),
                        borderRadius: BorderRadius.circular(10)),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        ClipRRect(
                          borderRadius: BorderRadius.circular(7), // 设置圆角大小
                          child: Image.asset(
                            'static/aaa.png',
                            width: 60,
                            height: 80,
                            fit: BoxFit.fill,
                          ),
                        ),
                        Expanded(
                            child: Padding(
                          padding: EdgeInsets.symmetric(horizontal: 10),
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text(
                                '策划人要拥有的14张推要拥有的14张要拥有的14张广排期表！高',
                                style: TextStyle(
                                  fontSize: 14,
                                  fontWeight: FontWeight.bold,
                                  overflow: TextOverflow.ellipsis,
                                ),
                              ),
                              Text(
                                '日期：10.23 12:22 -12.02 12:22',
                                style: TextStyle(
                                  fontSize: 12,
                                ),
                              ),
                              Text(
                                '奖励：233ST',
                                style: TextStyle(
                                  fontSize: 12,
                                ),
                              ),
                              Text(
                                '奖励：233ST',
                                style: TextStyle(
                                  fontSize: 12,
                                ),
                              ),
                              Text(
                                '奖励：233ST',
                                style: TextStyle(
                                  fontSize: 12,
                                ),
                              ),
                              Text(
                                '奖励：233ST',
                                style: TextStyle(
                                  fontSize: 12,
                                ),
                              ),
                              Align(
                                  alignment: Alignment.centerRight,
                                  child: Container(
                                    alignment: Alignment.center,
                                    width: 80,
                                    height: 32,
                                    decoration: BoxDecoration(
                                      borderRadius: BorderRadius.circular((32)),
                                      gradient: LinearGradient(
                                        colors: [
                                          Color(0xff2189E7),
                                          Color(0xffBF67F8),
                                        ], // 定义颜色列表
                                        begin: Alignment.topLeft, // 渐变开始的位置
                                        end: Alignment.bottomRight, // 渐变结束的位置
                                      ),
                                    ),
                                    child:
                                    GestureDetector(
                                      onTap: ()=>{
                                        Get.toNamed('/talk/release_details')
                                      },
                                      child: Text(
                                      '查看明细',
                                      style: TextStyle(
                                          fontSize: 12,
                                          color: Color(0XFFFFFFFF)),
                                    ),
                                    ) ,
                                  ))
                            ],
                          ),
                        )),
                      ],
                    ),
                  )
                ],
              ),
            ),

              GestureDetector(
                onTap: ()=>{
                    Get.toNamed('/talk/publish_task')
                },
                child:
            Container(
              margin: EdgeInsets.symmetric(horizontal: 40, vertical: 40),
              alignment: Alignment.center,
              height: 50,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular((50)),
                gradient: LinearGradient(
                  colors: [
                    Color(0xff2189E7),
                    Color(0xffBF67F8),
                  ], // 定义颜色列表
                  begin: Alignment.topLeft, // 渐变开始的位置
                  end: Alignment.bottomRight, // 渐变结束的位置
                ),
              ),
              child: 
              Text(
                '发布新任务',
                style: TextStyle(fontSize: 16, color: Color(0XFFFFFFFF)),
              ),
              )
              
            )

          ],
        ));
  }
}
